﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WindowsGame1.Model.Levels
{
    class Level1
    {
        //fält
        private static int  _levelWidth = Level.g_levelWidth;
        private static int  _levelHeight = Level.g_levelHeight;
        internal Tile[,]    _tiles;
        
        //funktion som bestämmer på hur banan ska se ut
        internal Tile[,] GenerateLevel()
        {
            _tiles = new Tile[_levelWidth, _levelHeight];

            for (int x = 0; x < _levelWidth; x++)
            {
                for (int y = 0; y < _levelHeight; y++)
                {
                    _tiles[x, y] = new Tile();
                }
            }

            //ENEMY
            _tiles[30, 17]._tileType = Tile.TileType.T_CHICKEN_SPAWN_POSITION;
            _tiles[39, 17]._tileType = Tile.TileType.T_CHICKEN_SPAWN_POSITION;
            _tiles[55, 17]._tileType = Tile.TileType.T_CHICKEN_SPAWN_POSITION;
            _tiles[69, 17]._tileType = Tile.TileType.T_CHICKEN_SPAWN_POSITION;
            _tiles[74, 17]._tileType = Tile.TileType.T_CHICKEN_SPAWN_POSITION;

            //CARROTS
            _tiles[25, 11]._tileType = Tile.TileType.T_CARROT_POSITION;
            _tiles[55, 15]._tileType = Tile.TileType.T_CARROT_POSITION;
            _tiles[66, 12]._tileType = Tile.TileType.T_CARROT_POSITION;

            //spikes
            for (int x = 1; x < 200; x++)
            {
                _tiles[x, 19]._tileType = Tile.TileType.T_TRAP;
            }

            //First ground
            for (int x = 0; x < 40; x++)
            {
                _tiles[x, 18]._tileType = Tile.TileType.T_GROUND;
                _tiles[x, 19]._tileType = Tile.TileType.T_BLOCKED;
            }


            for (int x = 8; x < 12; x++)
            {
                _tiles[x, 14]._tileType = Tile.TileType.T_GROUND;
            }

            //Stares

            for (int x = 15; x < 17; x++)
            {
                _tiles[x, 16]._tileType = Tile.TileType.T_GROUND;
            }

            for (int x = 19; x < 21; x++)
            {
                _tiles[x, 14]._tileType = Tile.TileType.T_GROUND;
            }

            for (int x = 23; x < 25; x++)
            {
                _tiles[x, 12]._tileType = Tile.TileType.T_GROUND;
            }

            //second ground
            for (int x = 44; x < 48; x++)
            {
                _tiles[x, 18]._tileType = Tile.TileType.T_GROUND;
                _tiles[x, 19]._tileType = Tile.TileType.T_BLOCKED;
            }

            for (int x = 50; x < 52; x++)
            {
                _tiles[x, 15]._tileType = Tile.TileType.T_GROUND;
            }

            //third ground
            for (int x = 54; x < 58; x++)
            {
                _tiles[x, 18]._tileType = Tile.TileType.T_GROUND;
                _tiles[x, 19]._tileType = Tile.TileType.T_BLOCKED;
            }

            //third spikes
            for (int x = 58; x < 68; x++)
            {
                _tiles[x, 19]._tileType = Tile.TileType.T_TRAP;
            }

            for (int x = 60; x < 64; x++)
            {
                _tiles[x, 15]._tileType = Tile.TileType.T_GROUND;
            }

            //#4 ground
            for (int x = 68; x < 75; x++)
            {
                _tiles[x, 18]._tileType = Tile.TileType.T_GROUND;
                _tiles[x, 19]._tileType = Tile.TileType.T_BLOCKED;
            }

            //#4 spikes
            for (int x = 75; x < 80; x++)
            {
                _tiles[x, 19]._tileType = Tile.TileType.T_TRAP;
            }

            //air wall
            for (int x = 80; x < 82; x++)
            {
                _tiles[x, 13]._tileType = Tile.TileType.T_GROUND;
                _tiles[x, 14]._tileType = Tile.TileType.T_BLOCKED;
            }

            //#5 ground
            for (int x = 80; x < 84; x++)
            {
                _tiles[x, 18]._tileType = Tile.TileType.T_GROUND;
                _tiles[x, 19]._tileType = Tile.TileType.T_BLOCKED;
            }

            //jumping
            for (int x = 84; x < 86; x++)
            {
                _tiles[x, 15]._tileType = Tile.TileType.T_GROUND;
                _tiles[x, 16]._tileType = Tile.TileType.T_BLOCKED;
            }

            for (int x = 88; x < 90; x++)
            {
                _tiles[x, 13]._tileType = Tile.TileType.T_GROUND;
                _tiles[x, 14]._tileType = Tile.TileType.T_BLOCKED;
            }

            for (int x = 92; x < 94; x++)
            {
                _tiles[x, 11]._tileType = Tile.TileType.T_GROUND;
                _tiles[x, 12]._tileType = Tile.TileType.T_BLOCKED;
            }

            //ground
            for (int x = 95; x < 100; x++)
            {
                _tiles[x, 15]._tileType = Tile.TileType.T_GROUND;
                _tiles[x, 16]._tileType = Tile.TileType.T_BLOCKED;
            }

            //jumping
            for (int x = 104; x < 106; x++)
            {
                _tiles[x, 15]._tileType = Tile.TileType.T_GROUND;
                _tiles[x, 16]._tileType = Tile.TileType.T_BLOCKED;
            }

            for (int x = 108; x < 110; x++)
            {
                _tiles[x, 13]._tileType = Tile.TileType.T_GROUND;
                _tiles[x, 14]._tileType = Tile.TileType.T_BLOCKED;
            }

            for (int x = 112; x < 114; x++)
            {
                _tiles[x, 11]._tileType = Tile.TileType.T_GROUND;
                _tiles[x, 12]._tileType = Tile.TileType.T_BLOCKED;
            }

            //air-ground
            for (int x = 120; x < 125; x++)
            {
                _tiles[x, 9]._tileType = Tile.TileType.T_GROUND;
            }

            //air-obstucle
            for (int x = 130; x < 132; x++)
            {
                _tiles[x, 11]._tileType = Tile.TileType.T_GROUND;
                _tiles[x, 12]._tileType = Tile.TileType.T_BLOCKED;
            }

            for (int x = 134; x < 135; x++)
            {
                _tiles[x, 14]._tileType = Tile.TileType.T_GROUND;
                _tiles[x, 15]._tileType = Tile.TileType.T_BLOCKED;
            }


            //ground
            for (int x = 137; x < 145; x++)
            {
                _tiles[x, 18]._tileType = Tile.TileType.T_GROUND;
                _tiles[x, 19]._tileType = Tile.TileType.T_BLOCKED;
            }

            //air-obstucle
            for (int x = 141; x < 142; x++)
            {
                _tiles[x, 17]._tileType = Tile.TileType.T_GROUND;
            }

            for (int x = 146; x < 147; x++)
            {
                _tiles[x, 14]._tileType = Tile.TileType.T_GROUND;
            }

            for (int x = 151; x < 152; x++)
            {
                _tiles[x, 12]._tileType = Tile.TileType.T_GROUND;
            }

            for (int x = 154; x < 155; x++)
            {
                _tiles[x, 15]._tileType = Tile.TileType.T_GROUND;
            }

            //ground
            for (int x = 157; x < 165; x++)
            {
                _tiles[x, 18]._tileType = Tile.TileType.T_GROUND;
                _tiles[x, 19]._tileType = Tile.TileType.T_BLOCKED;
            }

            //final obstucles
            _tiles[160, 17]._tileType = Tile.TileType.T_GROUND;

            _tiles[164, 15]._tileType = Tile.TileType.T_GROUND;

            _tiles[168, 13]._tileType = Tile.TileType.T_GROUND;

            for (int y = 19; y > 10; y--)
            {
                _tiles[174, y]._tileType = Tile.TileType.T_BLOCKED;
            }

            _tiles[174, 10]._tileType = Tile.TileType.T_GROUND;

            for (int y = 19; y > 7; y--)
            {
                _tiles[177, y]._tileType = Tile.TileType.T_BLOCKED;
            }

            _tiles[177, 7]._tileType = Tile.TileType.T_GROUND;

            for (int y = 19; y > 9; y--)
            {
                _tiles[181, y]._tileType = Tile.TileType.T_BLOCKED;
            }

            _tiles[185, 14]._tileType = Tile.TileType.T_GROUND;

            for (int y = 19; y > 14; y--)
            {
                _tiles[185, y]._tileType = Tile.TileType.T_BLOCKED;
            }

            _tiles[181, 9]._tileType = Tile.TileType.T_GROUND;

            for (int x = 190; x < 200; x++)
            {
                _tiles[x, 19]._tileType = Tile.TileType.T_BLOCKED;
                _tiles[x, 18]._tileType = Tile.TileType.T_BLOCKED;
                _tiles[x, 17]._tileType = Tile.TileType.T_BLOCKED;
                _tiles[x, 16]._tileType = Tile.TileType.T_GROUND;
            }



            //Basket
            _tiles[198, 15]._tileType = Tile.TileType.T_BASKET;

            
            return _tiles;
        }

    }
}
